<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Vue</title>
</head>
<body>
  <div id="el">
    <p>{{ dog }} {{ o }}</p>
    <button @click="clickHandler">修改狗的名字</button>
  </div>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.6.12/vue.js"></script>
  <script>
    let vm = new Vue({
      el: '#el',
      data: {
        o: 'object',
        dog: {}
      },
      methods: {
        clickHandler() {
          // 该 name 属性是否是响应式的
          // this.dog.name = 'Trump'
          // this.dog = {
          //   name: 'Trump'
          // }
          Vue.set(this.dog, 'name', 'Trump');
        }
      }
    })
  </script>
</body>
</html>
